﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entity.Car_Rental;
namespace Data.Car_Rental
{
    public class WebAccountRecordsRepository : Car_RentalRepositoryBase, IWebAccountRecordsRepository
    {
        #region IRepository<WebAccountRecords> 成员

        public void Update(WebAccountRecords entity)
        {
            base.UpdateEntity(entity);
        }

        public void Update(IList<WebAccountRecords> list)
        {
            base.UpdateEntity(list.Cast<Entity.EntityBase>().ToList());
        }

        public void Insert(WebAccountRecords entity)
        {
            base.InsertEntity(entity);
        }

        public void Insert(IList<WebAccountRecords> list)
        {
            base.InsertEntity(list.Cast<Entity.EntityBase>().ToList());
        }

        public WebAccountRecords InsertGetIDENTITY(WebAccountRecords entity)
        {
            base.InsertEntity(entity);
            return this.Find(entity.PrimaryKey);
        }

        public void Delete(WebAccountRecords entity)
        {
            base.DeleteEntity(entity);
        }

        public void Delete(IList<WebAccountRecords> list)
        {
            base.DeleteEntity(list.Cast<Entity.EntityBase>().ToList());
        }

        public IQueryable<WebAccountRecords> GetModel()
        {
            return base.GetEntities<WebAccountRecords>().Select(item => new WebAccountRecords_Ext
            {
                ActionType = item.ActionType,
                Amount = item.Amount,
                Balance = item.Balance,
                CreateDate = item.CreateDate,
                FlowType = item.FlowType,
                Note = item.Note,
                Operator = item.Operator,
                OrderID = item.OrderID,
                SplitPercent = item.SplitPercent,
                Status = item.Status,
                UpdateDate = item.UpdateDate,
                WebAccountRecordID = item.WebAccountRecordID,
            });
        }

        public WebAccountRecords Find(params object[] keyValues)
        {
            return base.Find<WebAccountRecords>(keyValues);
        }

        #endregion
    }
}
